package com.afdor.rws.event.driven.config;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 事件相关基础配置信息
 *
 * @author 悭梵
 * @date Created in 2018-12-11 9:54
 */
@NoArgsConstructor
@AllArgsConstructor
public abstract class BaseEventConfig implements Serializable, Cloneable {
    /**
     * 基础配置信息
     */
    private EventConfig eventConfig;

    public <T extends EventConfig> T getEventConfig() {
        return (T) this.eventConfig;
    }

    public void setEventConfig(EventConfig eventConfig) {
        this.eventConfig = eventConfig;
    }

    public String getIdStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getIdStrategyName();
    }

    public void setIdStrategyName(String idStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setIdStrategyName(idStrategyName);
        }
    }

    public String getTimestampStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getTimestampStrategyName();
    }

    public void setTimestampStrategyName(String timestampStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setTimestampStrategyName(timestampStrategyName);
        }
    }

    public String getEventBusStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventBusStrategyName();
    }

    public void setEventBusStrategyName(String eventBusStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventBusStrategyName(eventBusStrategyName);
        }
    }

    public String getEventSourceStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventSourceStrategyName();
    }

    public void setEventSourceStrategyName(String eventSourceStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventSourceStrategyName(eventSourceStrategyName);
        }
    }

    public String getEventSourceManagerStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventSourceManagerStrategyName();
    }

    public void setEventSourceManagerStrategyName(String eventSourceManagerStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventSourceManagerStrategyName(eventSourceManagerStrategyName);
        }
    }

    public String getPersistenceManagerStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventPersistenceManagerStrategyName();
    }

    public void setPersistenceManagerStrategyName(String persistenceManagerStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventPersistenceManagerStrategyName(persistenceManagerStrategyName);
        }
    }

    public String getEventChannelStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventChannelStrategyName();
    }

    public void setEventChannelStrategyName(String eventChannelStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventChannelStrategyName(eventChannelStrategyName);
        }
    }

    public String getSerializationStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getSerializationStrategyName();
    }

    public void setSerializationStrategyName(String serializationStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setSerializationStrategyName(serializationStrategyName);
        }
    }

    public String getEventProducerStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventProducerStrategyName();
    }

    public void setEventProducerStrategyName(String eventProducerStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventProducerStrategyName(eventProducerStrategyName);
        }
    }

    public String getEventConsumerStrategyName() {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig == null) {
            return null;
        }
        return eventConfig.getEventConsumerStrategyName();
    }

    public void setEventConsumerStrategyName(String eventConsumerStrategyName) {
        EventConfig eventConfig = getEventConfig();
        if (eventConfig != null) {
            eventConfig.setEventConsumerStrategyName(eventConsumerStrategyName);
        }
    }
}
